<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="data">
        <h3>节流测试</h3>
        <span>{{num}}</span>
        <button @click="add">+</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        let vue = new Vue({
            el: '.data',
            data: {
                num: 1,
                key: '',
            },
            methods: {
                add() {
                    if (this.key === '进行中') {
                        return
                    }
                    // 点击赋值
                    this.key = '进行中'
                    setTimeout(() => {
                        this.num++
                        this.key = '结束了'
                    }, 1000)

                }
            }
        })
    </script>
</body>

</html>